package com.ailink.spring;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MyConfig implements BeanFactoryAware {

    public MyConfig() {
    }

    private BeanFactory beanFactory;

    public BeanFactory getBeanFactory() {
        return beanFactory;
    }

    public void setBeanFactory(BeanFactory beanFactory) {
        this.beanFactory = beanFactory;
    }

    public Object myConfig() {
        return new Object();
    }

    @Bean
    public Object myConfigBean1() {
        myConfig();
        return new Object();
    }

    @Bean
    public Object myConfigBean2() {
        myConfig();
        staticBean();
        Object myConfigBean1 = myConfigBean1();
        System.out.println(myConfigBean1);
        return new Object();
    }

    @Bean
    public static Object staticBean() {
        return new Object();
    }
}
